using System;
using System.Windows.Forms;
using BizTalk.BuildGenerator.UI.Navigation;
using BizTalk.BuildGenerator.MetaData;

namespace BizTalk.BuildGenerator.UI.UserControls
{
    public partial class BizTalkHostsControl : UserControl, IWizardControl
    {
        private GenerationArgs _args;
       
        public void RegisterHosts(GenerationArgs args)
        {
            _args = args;
            BizTalkHostsPropertyGrid.SelectedObject = _args.BizTalkHosts;
        }

        public BizTalkHostsControl()
        {
            InitializeComponent();
        }
       
        #region IWizardControl Members

        public MoveNextResult MoveNext()
        {
            var result = new MoveNextResult {CanMoveNext = true};
            return result;
        }

        #endregion

        private void BizTalkHostsControlLoad(object sender, EventArgs e)
        {
            if (DesignMode) return;
            foreach(var host in _args.BizTalkHosts.Hosts)
                host.RefreshAdapters();
        }
    }
}